package com.beiding.pojo.room;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;

import java.io.Serializable;
import java.util.List;
import java.util.Set;


/**
 * 集成对elasticsearch的支持.仅支持搜索名称,简介,位置.在本地存储的字段有id,名称,位置,简介,以及创建时间戳.如需查看详情则通过id想roomStorage发起调用
 */
@Getter
@Setter
public class Room implements Serializable {

    //房间id
    @Id
    private String id;

    private String name;

    private Location location;

    private String description;

    private List<Price> prices;

    private Set<String> images;

    private boolean published;

    private String theUser;

    public void setPrices(List<Price> prices) {
        this.prices = prices;

        for (int i = 0; i < prices.size(); i++) {
            prices.get(i).setSerial(i+1);
        }

    }

    /*********** 自动管理 ***********/

    private String holderId;

}
